package org.dreamwork.jasmine2.restful.client.gui.model;

import org.dreamwork.jasmine2.restful.APIDefinition;

import javax.swing.tree.DefaultMutableTreeNode;

/**
 * Created by IntelliJ IDEA.
 * User: seth.yang
 * Date: 2014/12/9
 * Time: 1:18
 */
public class ApiTreeNode extends DefaultMutableTreeNode {
    private APIDefinition api;

    public ApiTreeNode () {
        super ();
    }

    public ApiTreeNode (APIDefinition api) {
        super (api.getTitle ());
        this.api = api;
    }

    public ApiTreeNode (APIDefinition api, boolean allowsChildren) {
        super (api.getTitle (), allowsChildren);
        this.api = api;
    }

    @Override
    public void setUserObject (Object userObject) {
        super.setUserObject (((APIDefinition) userObject).getTitle ());
        this.api = (APIDefinition) userObject;
    }

    public APIDefinition getApi () {
        return api;
    }
}
